﻿using SmarterCharger.App.Resources;
using System;
using System.Windows.Data;

namespace SmarterCharger.App.Converters
{
    public class IsChargingToButtonTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var isCharging = (value is bool && (bool)value);

            if (isCharging)
                return AppResources.Button_Charging;
            else
                return AppResources.Button_Charge;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var isCharging = (value is string && value.ToString() == AppResources.Button_Charge);

            return isCharging;
        }
    }
}
